#include "GameObjectManager.h"


namespace App
{

GameObjectManager::GameObjectManager()
{

}

GameObjectManager::~GameObjectManager()
{

}

void GameObjectManager::AddGameObject(GameObject* pGameObject)
{
   m_vGameObject.push_back(pGameObject);
   m_mGameObject.insert(std::pair<std::string,GameObject*>(pGameObject->getName(),pGameObject));
}

GameObject* GameObjectManager::FindGameObject(std::string name)
{
    return m_mGameObject[name];
}

void GameObjectManager::FindGameObjectWithTag(std::vector<GameObject*> &vGameObject,std::string &tag)
{
	for (int i=0;i<m_vGameObject.size();i++)
	{
		if (m_vGameObject[i]->getTag() == tag)
		{
            vGameObject.push_back(m_vGameObject[i]);
		}
	}
}

void GameObjectManager::Update(float delta)
{
    for (int i=0;i<m_vGameObject.size();i++)
    {
		m_vGameObject[i]->Update(delta);
    }
}

}
